#include "mainwindow.h"
#include "CTestDbus.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow( QWidget* parent ) : QMainWindow( parent ), ui( new Ui::MainWindow ) {
    ui->setupUi( this );
    QDBusConnection connection = QDBusConnection::sessionBus();
    if ( !connection.registerService( "com.lanhai.Server" ) ) {
        qDebug() << "error" << connection.lastError().message();
        return;
    }
    CTestDbus* obj = new CTestDbus;
    if ( !connection.registerObject( "/com/ObjectPath/CTestDbus", obj, QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals ) ) {
        qDebug() << "error:" << connection.lastError().message();
        return;
    }
}

MainWindow::~MainWindow() {
    delete ui;
}
